package com.c.ctgproject.adapter.guang

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.c.ctgproject.R
import com.c.ctgproject.databinding.ItemFirstCheckCountListBinding
import com.c.ctgproject.entity.guang.CarInfoEntityV2
import com.c.ctgproject.utils.noDataHandler

class FirstCheckCountAdapter (private val context: Context, private val mList: List<CarInfoEntityV2.DataBean.CarPartsListBean>) : RecyclerView.Adapter<FirstCheckCountAdapter.MyViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
        val view = ItemFirstCheckCountListBinding.inflate(LayoutInflater.from(context), parent, false)
        return MyViewHolder(view)
    }

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        val data=mList[position]
        holder.mStartTV.text=data.partsName.noDataHandler()
        holder.mEndTV.text=data.partsCount.noDataHandler()
    }

    override fun getItemCount(): Int {
        return mList.size
    }

    inner class MyViewHolder(view: ItemFirstCheckCountListBinding) : RecyclerView.ViewHolder(view.root) {
        val mStartTV = view.mStartTV
        val mEndTV = view.mEndTV
    }
}